from sys import argv
from os.path import exists

script, from_file, to_file = argv

print(f"Copying from {from_file} to {to_file}")

#打开需要复制的源文件
in_file = open(from_file)
#读取源文件的内容
indata = in_file.read()
# we could do these two on one line?
# in_file = open(from_file).read()

# 输出源文件的长度
print(f"The input file is {len(indata)} bytes long")

#exists(to_file):True代表文件存在，False代表不存在
print(f"Does the output file exist? {exists(to_file)}")
print("Ready, hit RETURN to continue, CTRL-C to abort.")
input()

# 以写的方式打开要复制到的目标文件
out_file = open(to_file,"w")
# 将源文件的内容写进目标文件
out_file.write(indata)

print("Alright, all done.")

out_file.close()
in_file.close()